Skip to content

XDS client support.#2

Open
samuel-williams-shopify wants to merge 6 commits intomainfrom
xds
Open

XDS client support.#2
samuel-williams-shopify wants to merge 6 commits intomainfrom
xds

Conversation

@samuel-williams-shopify
Copy link
Contributor

@samuel-williams-shopify samuel-williams-shopify commented Mar 10, 2026

Use XDS to keep an up to date list of endpoints for clients to connect to.

bootstrap = {
  xds_servers: [
    {
      server_uri: "xds-control-plane:18000",
      channel_creds: [{ type: "insecure" }]
    }
  ],
  node: {
    id: "test-client-#{Process.pid}",
    cluster: "test"
  }
}

client = Async::GRPC::XDS::Client.new("myservice", bootstrap: bootstrap)

stub = client.stub(Async::GRPC::Fixtures::TestInterface, "myservice")

request = Protocol::GRPC::Fixtures::TestMessage.new(value: "hello")
response = stub.unary_call(request)
puts response.value

In comparison to normal Async::GRPC::Client:

endpoint = Async::HTTP::Endpoint.parse(
  "http://localhost:50051",
  protocol: Async::HTTP::Protocol::HTTP2
)

http_client = Async::HTTP::Client.new(endpoint)
client = Async::GRPC::Client.new(http_client)

stub = client.stub(Async::GRPC::Fixtures::TestInterface, "myservice")

request = Protocol::GRPC::Fixtures::TestMessage.new(value: "hello")
response = stub.unary_call(request)
puts response.value

Types of Changes

  • New feature.

Contribution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants